<%@ tag language="java" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ attribute name="name" type="java.lang.String" required="true" description="验证码输入框名称"%>
<%@ attribute name="inputCssStyle" type="java.lang.String" required="false" description="验证框样式"%>
<%@ attribute name="linkCssStyle" type="java.lang.String" required="false" description="看不清链接样式"%>
<%@ attribute name="noRefresh" type="java.lang.Boolean" required="false" description="点击图片不执行刷新"%>
<%--
	调用实例：
	<sys:validateCode name="validateCode" />

	表单验证：
	$("#inputForm").validate({
		rules: {
			validateCode: {remote: "${pageContext.request.contextPath}/servlet/validateCodeServlet"}
		},
		messages: {
			validateCode: {remote: "验证码不正确"}
		},
		// 以下代码省略
	});
--%>
<input type="text" id="${name}" name="${name}" maxlength="5" class="txt required" style="border:1px solid #ddd;height:26px;font-weight:bold;width:45px;margin-bottom:0;padding:2px 2px 3px 2px;vertical-align:middle;${inputCssStyle}"/>
<img src="" onclick="$('.${name}Refresh').click();" class="hide ${name}" style="vertical-align:middle;"/>
<a href="javascript:" onclick="$('.${name}').attr('src','${pageContext.request.contextPath}/servlet/validateCodeServlet?'+new Date().getTime()).removeClass('hide');" class="${name}Refresh" style="vertical-align:middle;${linkCssStyle}">看不清</a>
<c:if test="${!noRefresh}"><script>setTimeout(function(){$('.${name}Refresh').click()}, 1000);</script></c:if>